package UIFree.graphicTools.color.palettes
{
	import UIFree.uif_bitmap;
	import UIFree.uif_component;
	import UIFree.uif_ecomponent;
	
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.geom.Rectangle;
	
	public class uif_basePaletteView extends uif_ecomponent {
		private var _bitmap: uif_bitmap;
		public function uif_basePaletteView(parent:uif_component, ax:int=0, ay:int=0, awidth:int=0, aheight:int=0, styleClass:Object='') {
			super(parent, ax, ay, awidth, aheight, styleClass);
			createComponents();
		}
		
		protected function createComponents(): void {
			var inner: Rectangle = getInner();
			_bitmap = new uif_bitmap(new BitmapData(inner.width, inner.height, false, 0));
			_bitmap.x = inner.x;
			_bitmap.y = inner.y;
			updatePalette();
			addChild(_bitmap);
		}
		
		public function get stepSize(): Number {
			return 8;
		}
		
		protected function updatePalette(): void {
			drawPalette(_bitmap.bitmapData);
		}
		
		public function getColor(x: Number, y: Number): uint {
			return _bitmap.bitmapData.getPixel(x, y);
		}
		
		protected function drawPalette(a_bmd: BitmapData): void {
			
		}
	}
}